home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group99a.txt / 000026_icon-group-sender _Tue Feb 9 08:53:24 1999.msg < prev    next >
Internet Message Format  |  2000-09-20  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id IAA27464
  4.     for icon-group-addresses; Tue, 9 Feb 1999 08:50:52 -0700 (MST)
  5. Message-Id: <199902091550.IAA27464@baskerville.CS.Arizona.EDU>
  6. To: icon-group@optima.CS.Arizona.EDU
  7. Date: 08 Feb 1999 19:11:44 -0500
  8. From: clayton@jazz.cc.gatech.edu (R. Clayton)
  9. Subject: Calling C functions under Solaris.
  10. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  11. Status: RO
  12.  
  13. I'd like to call some C functions from with an Icon program under Solaris, and
  14. I'm having a little trouble.  First, here's what I'm doing and what I'd like to
  15. have happen (I don't care that the error number is the wrong one):
  16.  
  17.   ja uname -a
  18.   SunOS jazz 4.1.3 1 sun4m
  19.  
  20.   ja cat ps.c
  21.   #include "rt.h"
  22.  
  23.   int printstring(argc, argv) 
  24.  
  25.     int argc;
  26.     struct descrip * argv;
  27.  
  28.    {char str[MaxCvtLen];
  29.     if (qtos(argv[1], str) == Error) return 101;
  30.     printf("printstring parameter is \"%s\".\n", str);
  31.     return 0;
  32.     }
  33.  
  34.   ja cat ps.icn
  35.   procedure main()
  36.  
  37.     local printstring
  38.  
  39.     printstring := loadfunc("./ps.so", "printstring") |
  40.       stop("Couldn't load printstring().")
  41.  
  42.     printstring("Hello world!")
  43.  
  44.     end # main
  45.  
  46.   ja make
  47.   cc -I/usr/local/icon-9.3/src/h -I/usr/openwin/include   -c ps.c -o ps.o
  48.   ld -o ps.so ps.o
  49.   icont -u ps.icn
  50.   Translating:
  51.   ps.icn:
  52.     main
  53.   No errors
  54.   Linking:
  55.  
  56.   ja ./ps
  57.   printstring parameter is "Hello world!".
  58.  
  59.   ja 
  60.  
  61. So everything works under SunOS.  Here's Solaris:
  62.  
  63.   ma uname -a
  64.   SunOS mayzie 5.5.1 Generic_103640-24 sun4u sparc SUNW,Ultra-2
  65.  
  66.   ma rm *o
  67.  
  68.   ma make
  69.   cc -I/usr/local/icon-9.3/src/h -I/usr/openwin/include   -c ps.c -o ps.o
  70.   "/usr/local/icon-9.3/src/h/../h/config.h", line 424: warning: macro
  71.   replacement within a string literal 
  72.   cc -G -K pic -o ps.so ps.o
  73.   icont -u ps.icn
  74.   Translating:
  75.   ps.icn:
  76.     main
  77.   No errors
  78.   Linking:
  79.  
  80.   ma ./ps
  81.  
  82.   loadfunc("./ps.so","printstring"): ld.so.1: /usr/local/public/bin/iconx:
  83.   fatal: relocation error: file ./ps.so: symbol qtos: referenced symbol not
  84.   found 
  85.  
  86.   Run-time error 216
  87.   File ps.icn; Line 5
  88.   external function not found
  89.   Traceback:
  90.      main()
  91.      loadfunc("./ps.so\x00","printstring\x00") from line 5 in ps.icn
  92.  
  93.   ma
  94.  
  95. I'm thinking I'm missing an Icon library under Solaris, but I can't find one in
  96. the source tree or the executable directories.
  97.  
  98. And while I have your attention: does anybody know if there are C-callable
  99. routines for creating and manipulating Icon lists?  Eventually I'm going to
  100. want to write some C routines that return a list of strings.
  101.